/**
 * @author:linjiye
 * @date: 2025/1/7
 * @desc:
 **/

import {StyleSheet, Text, View, Image, TouchableOpacity} from 'react-native'
import React from 'react'
import {Flex} from "@ant-design/react-native";
import {LinearGradient} from "expo-linear-gradient";
import FcFileItem from "@/components/FcFileItem";

type Props = {}

const FileList = ({list, style,onClickSelect}: Props) => {
    const handleSelect = (val) => {
        // let newList = [...list]
        // newList[index].isSelected = !newList[index].isSelected
        //
        // let newSelectData = newList?.filter(item => item.isSelected)
        // setList(newList)
        // setSelectData(newSelectData)
        onClickSelect && onClickSelect(val)
    }
    return (
        <Flex wrap='wrap' style={[styles.container, style]}>
            <View style={styles.item_wrap}>
                <View style={[styles.item,styles.add]}>

                </View>
            </View>
            {list?.map((item, index) => (
                <View style={styles.item_wrap} key={index}>
                    <FcFileItem item={item} onClickSelect={handleSelect} onClickPlay={}/>
                </View>
            ))}

        </Flex>
    )
}

export default FileList

const styles = StyleSheet.create({
    container: {},

    item_wrap: {
        width: '50%',
        height: 116,
    },

    item: {
        flex: 1,
        borderRadius: 8,
        overflow: "hidden",
        position: "relative",
        margin: 4
    },
})